﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using System.Collections.Specialized;
using System.Reflection;
using System.IO;
using System.Security.Cryptography;
using com.huawei.esdk.tp.oa.DataType;

namespace com.huawei.esdk.tp.oa.Utils
{
    public partial class UtilsSettings
    {
        //public Configuration appSettings = null;

        private static string name;
        private static string password;
        //RSA2048 rsa;

        public UtilsSettings(string userName, string passWord, string serverURL, string PlatformKeyURL)
        {
            //rsa = new RSA2048(PlatformKeyURL);
            this._URL = serverURL;
            name = userName;
            password = passWord;
            //password = rsa.RSAEncrypt(passWord);
        }

        //public UtilsSettings(string platformKeyURL)
        //{
        //    this._PlatformKeyURL = platformKeyURL;
        //}

        private  string _URL;
        /// <summary>
        /// 获取服务器地址
        /// </summary>
        public  string URL
        {
            get
            {
                if (_URL == null)
                    _URL = "https://localhost:18543/esdk/services/tpOAConfMgr";
                return _URL;
            }
        }

        //private string _PlatformKeyURL;
        ///// <summary>
        ///// 获取服务器地址
        ///// </summary>
        //public string PlatformKeyURL
        //{
        //    get
        //    {
        //        if (_PlatformKeyURL == null)
        //            _PlatformKeyURL = "https://localhost:18543/esdk/services/platformKeyMgr";
        //        return _PlatformKeyURL;
        //    }
        //}

        private  AuthenticationToken _Header;
        public  AuthenticationToken Header
        {
            get
            {
                AuthenticationToken myHeader = new AuthenticationToken();
                myHeader.userName = name;
                myHeader.password = password;
                _Header = myHeader;
                return _Header;
            }
        }           
    }
}
